package com.fary.feign;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class UserFallbackFactory implements FallbackFactory<UserFeign> {

    @Override
    public UserFeign create(final Throwable cause) {
        log.error("UserRemoteClient回退：", cause);
        return new UserFeign() {
            @Override
            public String hello() {
                return "fail";
            }
        };
    }
}